package com.hs.srm.base.common.utils;

/**
 * 通知模板编码
 * @author Wangpeidong
 * @create 2018-07-06 11:01
 **/
public class SmsConst {

    /**
     * 模板中参数的占位符
     */
    public final static String TEMPLATE_PLACEHOLDER = "xx";

    /**
     * 模板编码
     */
    public enum SmsTemplateCodeEnum {

        /**********系统通知***********/
        SYS_SMS_OVER("9999", "SMS_139231533", "店铺短信不足提醒"),

        /**********业务员通知***********/
        NEW_ORDER("1000", "SMS_139225910", "新订单提醒"),
        APPLY_CANCEL_ORDER("1001", "SMS_139225979", "申请取消订单"),
        HOUSE_KEEP_ORDER_CONTRACT_OVER("1002", "SMS_139240985", "家政订单完成签约"),
        APPLY_CANCEL_REJECT("1003", "SMS_139235934", "订单申请取消未通过"),
        APPLY_CANCEL_ALLOW("1004", "SMS_139225980", "订单申请取消成功"),
        CLEAN_UP_PAY_FINISH("1005", "SMS_139230936", "保洁订单雇主付完钱"),
        OVER_DUE_NOTICE("1006", "SMS_139235239", "质保单结束前3天提醒"),
        QUALITY_START_NOTICE("1007", "SMS_139235970", "质保单开始前1天提醒"),
        INTERVIEW_NOTICE("1008", "SMS_139230979", "面试前一天通知"),

        /**********雇主通知***********/
        EMP_ORDER_CANCEL("2001", "SMS_139225981", "订单取消成功"),
        EMP_ORDER_FINISH("2002", "SMS_139240963", "订单完成"),
        EMP_INTERVIEW_NOTICE("2003", "SMS_139240998", "面试前一天通知"),


        /**********阿姨通知***********/
        AUNT_INTERVIEW_NOTICE("3001", "SMS_139240999", "面试前一天通知"),
        AUNT_SHANGGONG_NOTICE("3002", "SMS_139226048", "派工通知");


        //系统编码
        private String sysCode;
        // 阿里大于模板编码
        private String templateCode;
        // 模板名称
        private String name;

        SmsTemplateCodeEnum(String sysCode, String templateCode, String name) {
            this.sysCode = sysCode;
            this.templateCode = templateCode;
            this.name = name;
        }

        /**
         * 根据sysCode获取templateCode
         *
         * @param sysCode
         * @return
         */
        public static String getNameByValue(String sysCode) {
            String templateCode = "";
            for (SmsTemplateCodeEnum item : SmsTemplateCodeEnum.values()) {
                if (item.sysCode.equals(sysCode)) {
                    templateCode = item.templateCode;
                    break;
                }
            }
            return templateCode;
        }

        public String getSysCode() {
            return sysCode;
        }

        public String getTemplateCode() {
            return templateCode;
        }

        public String getName() {
            return name;
        }
    }

    /**
     * 消息模板的接收人角色
     */
    public enum SmsRoleEnum {

        SALE_MAN(1, "业务员"),
        AUNT(3, "阿姨"),
        EMPLOYER(2, "雇主");

        private int value;
        private String name;

        SmsRoleEnum(Integer value, String name) {
            this.value = value;
            this.name = name;
        }

        /**
         * 根据value获取name
         *
         * @param value
         * @return
         */
        public static String getNameByValue(Integer value) {
            String name = "";
            for (SmsRoleEnum item : SmsRoleEnum.values()) {
                if (item.value == value) {
                    name = item.name;
                    break;
                }
            }
            return name;
        }

        public Integer getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }

    /**
     * 消息类型
     */
    public enum SmsTypeEnum {

        NOTICE(1, "公告"),
        REMIND(2, "消息");

        private int value;
        private String name;

        SmsTypeEnum(Integer value, String name) {
            this.value = value;
            this.name = name;
        }

        /**
         * 根据value获取name
         *
         * @param value
         * @return
         */
        public static String getNameByValue(Integer value) {
            String name = "";
            for (SmsTypeEnum item : SmsTypeEnum.values()) {
                if (item.value == value) {
                    name = item.name;
                    break;
                }
            }
            return name;
        }

        public Integer getValue() {
            return value;
        }

        public String getName() {
            return name;
        }

    }
}
